﻿// ThinSplitterWnd.cpp : implementation file
//

#include "stdafx.h"
#include "ThinSplitter.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

#define PANE_BORDER		1
#define PANE_SHARE		0
#define PANE_GAP		3

// /------------------------------------------------------------
// | FMTHClass
// | 
// | Class Name		: CThinSplitterWnd
// | Inherited from : CFMSplitterWnd
// | Created By     : sylvain
// | Creation Date  : Monday, September 29, 2003
// | 
// | Purpose        : Creates a non resizeable splitter wnd with thin border 
// | 
//  ------------------------------------------------------------


/////////////////////////////////////////////////////////////////////////////
// CThinSplitterWnd

CThinSplitterWnd::CThinSplitterWnd()
{
	m_cxSplitter=PANE_BORDER;     // = 1
	m_cySplitter=PANE_BORDER;     // = 1
	m_cxBorderShare=PANE_SHARE;   // = 0
	m_cyBorderShare=PANE_SHARE;   // = 0
	m_cxSplitterGap=m_cySplitterGap=PANE_GAP;
}

CThinSplitterWnd::~CThinSplitterWnd()
{
}

BEGIN_MESSAGE_MAP(CThinSplitterWnd, CTabSplitterWnd)
	//{{AFX_MSG_MAP(CThinSplitterWnd)
	ON_WM_NCHITTEST()
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CThinSplitterWnd message handlers
#if _MSC_VER < 1400
UINT CThinSplitterWnd::OnNcHitTest(CPoint point) 
#else
LRESULT CThinSplitterWnd::OnNcHitTest(CPoint point) 
#endif
{
	return 0;
}

void CThinSplitterWnd::OnDrawSplitter( CDC* pDC, ESplitType nType, const CRect& rect )
{
#define LP RGB(128,128,128)
#define RB RGB(192,192,192)

    //如果pDC 为 NULL则仅使分割窗口区域无效
    if (pDC == NULL)
    {
        RedrawWindow(rect, NULL, RDW_INVALIDATE|RDW_NOCHILDREN);
        return;
    }
    ASSERT_VALID(pDC);

    CRect rc = rect;

    switch(nType) 
    { 
    case splitBorder:
        //重画分割窗口边界
        pDC->Draw3dRect(rc,LP,LP);
        rc.InflateRect(-1,-1); 
        pDC->Draw3dRect(rc,RB,RB); 
        return; 
    case splitBox:
        pDC->Draw3dRect(rc,LP,LP);
        rc.InflateRect(-1,-1); 
        pDC->Draw3dRect(rc,LP,LP);
        rc.InflateRect(-1,-1);
        pDC->FillSolidRect(rc,RGB(128,128,128)); 
        pDC->Draw3dRect(rc,RB,RB);
        return; 
    case splitBar: 
        //重画分割条 
        pDC->FillSolidRect(rc,RGB(192,192,192));
        rc.InflateRect(-1,-1); 
        pDC->Draw3dRect(rc,RB,RB);  
        return; 
    default: 
        ASSERT(FALSE); 
    } 
    //填充中间的部分
    pDC->Draw3dRect(rect, GetSysColor(COLOR_BTNSHADOW), GetSysColor(COLOR_BTNHIGHLIGHT));

}
